home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / QuickdrawText.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  9.4 KB  |  305 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QuickdrawText.h
  3.  
  4.      Contains:    Quickdraw Text Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1983-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __QUICKDRAWTEXT__
  19. #define __QUICKDRAWTEXT__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __MIXEDMODE__
  25. #include <MixedMode.h>
  26. #endif
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=mac68k
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50.  
  51. enum {
  52.                                                                 /* CharToPixel directions */
  53.     leftCaret                    = 0,                            /*Place caret for left block*/
  54.     rightCaret                    = -1,                            /*Place caret for right block*/
  55.     kHilite                        = 1,                            /*Direction is SysDirection*/
  56.     smLeftCaret                    = 0,                            /*Place caret for left block - obsolete */
  57.     smRightCaret                = -1,                            /*Place caret for right block - obsolete */
  58.     smHilite                    = 1                                /*Direction is TESysJust - obsolete */
  59. };
  60.  
  61.  
  62. enum {
  63.                                                                 /*Constants for styleRunPosition argument in PortionLine, DrawJustified, MeasureJustified, CharToPixel, and PixelToChar.*/
  64.     onlyStyleRun                = 0,                            /* This is the only style run on the line */
  65.     leftStyleRun                = 1,                            /* This is leftmost of multiple style runs on the line */
  66.     rightStyleRun                = 2,                            /* This is rightmost of multiple style runs on the line */
  67.     middleStyleRun                = 3,                            /* There are multiple style runs on the line and this is neither the leftmost nor the rightmost. */
  68.     smOnlyStyleRun                = 0,                            /* obsolete */
  69.     smLeftStyleRun                = 1,                            /* obsolete */
  70.     smRightStyleRun                = 2,                            /* obsolete */
  71.     smMiddleStyleRun            = 3                                /* obsolete */
  72. };
  73.  
  74. /* type for styleRunPosition parameter in PixelToChar etc. */
  75. typedef short                             JustStyleCode;
  76. struct FontInfo {
  77.     short                             ascent;
  78.     short                             descent;
  79.     short                             widMax;
  80.     short                             leading;
  81. };
  82. typedef struct FontInfo FontInfo;
  83.  
  84. typedef short                             FormatOrder[1];
  85. typedef FormatOrder *                    FormatOrderPtr;
  86. /* FormatStatus was moved to TextUtils.i */
  87. struct OffPair {
  88.     short                             offFirst;
  89.     short                             offSecond;
  90. };
  91. typedef struct OffPair OffPair;
  92.  
  93. typedef OffPair                         OffsetTable[3];
  94. typedef CALLBACK_API( Boolean , StyleRunDirectionProcPtr )(short styleRunIndex, void *dirParam);
  95. typedef STACK_UPP_TYPE(StyleRunDirectionProcPtr)                 StyleRunDirectionUPP;
  96. enum { uppStyleRunDirectionProcInfo = 0x00000390 };             /* pascal 1_byte Func(2_bytes, 4_bytes) */
  97. #define NewStyleRunDirectionProc(userRoutine)                     (StyleRunDirectionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppStyleRunDirectionProcInfo, GetCurrentArchitecture())
  98. #define CallStyleRunDirectionProc(userRoutine, styleRunIndex, dirParam)  CALL_TWO_PARAMETER_UPP((userRoutine), uppStyleRunDirectionProcInfo, (styleRunIndex), (dirParam))
  99. EXTERN_API( short )
  100. Pixel2Char                        (Ptr                     textBuf,
  101.                                  short                     textLen,
  102.                                  short                     slop,
  103.                                  short                     pixelWidth,
  104.                                  Boolean *                leadingEdge)                        FOURWORDINLINE(0x2F3C, 0x820E, 0x0014, 0xA8B5);
  105.  
  106. EXTERN_API( short )
  107. Char2Pixel                        (Ptr                     textBuf,
  108.                                  short                     textLen,
  109.                                  short                     slop,
  110.                                  short                     offset,
  111.                                  short                     direction)                            FOURWORDINLINE(0x2F3C, 0x820C, 0x0016, 0xA8B5);
  112.  
  113. EXTERN_API( short )
  114. PixelToChar                        (Ptr                     textBuf,
  115.                                  long                     textLength,
  116.                                  Fixed                     slop,
  117.                                  Fixed                     pixelWidth,
  118.                                  Boolean *                leadingEdge,
  119.                                  Fixed *                widthRemaining,
  120.                                  JustStyleCode             styleRunPosition,
  121.                                  Point                     numer,
  122.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8222, 0x002E, 0xA8B5);
  123.  
  124. EXTERN_API( short )
  125. CharToPixel                        (Ptr                     textBuf,
  126.                                  long                     textLength,
  127.                                  Fixed                     slop,
  128.                                  long                     offset,
  129.                                  short                     direction,
  130.                                  JustStyleCode             styleRunPosition,
  131.                                  Point                     numer,
  132.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x821C, 0x0030, 0xA8B5);
  133.  
  134. EXTERN_API( void )
  135. DrawJustified                    (Ptr                     textPtr,
  136.                                  long                     textLength,
  137.                                  Fixed                     slop,
  138.                                  JustStyleCode             styleRunPosition,
  139.                                  Point                     numer,
  140.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8016, 0x0032, 0xA8B5);
  141.  
  142. EXTERN_API( void )
  143. MeasureJustified                (Ptr                     textPtr,
  144.                                  long                     textLength,
  145.                                  Fixed                     slop,
  146.                                  Ptr                     charLocs,
  147.                                  JustStyleCode             styleRunPosition,
  148.                                  Point                     numer,
  149.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x801A, 0x0034, 0xA8B5);
  150.  
  151. EXTERN_API( Fixed )
  152. PortionLine                        (Ptr                     textPtr,
  153.                                  long                     textLen,
  154.                                  JustStyleCode             styleRunPosition,
  155.                                  Point                     numer,
  156.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8412, 0x0036, 0xA8B5);
  157.  
  158. EXTERN_API( void )
  159. HiliteText                        (Ptr                     textPtr,
  160.                                  short                     textLength,
  161.                                  short                     firstOffset,
  162.                                  short                     secondOffset,
  163.                                  OffsetTable             offsets)                            FOURWORDINLINE(0x2F3C, 0x800E, 0x001C, 0xA8B5);
  164.  
  165. EXTERN_API( void )
  166. DrawJust                        (Ptr                     textPtr,
  167.                                  short                     textLength,
  168.                                  short                     slop)                                FOURWORDINLINE(0x2F3C, 0x8008, 0x001E, 0xA8B5);
  169.  
  170. EXTERN_API( void )
  171. MeasureJust                        (Ptr                     textPtr,
  172.                                  short                     textLength,
  173.                                  short                     slop,
  174.                                  Ptr                     charLocs)                            FOURWORDINLINE(0x2F3C, 0x800C, 0x0020, 0xA8B5);
  175.  
  176. EXTERN_API( Fixed )
  177. PortionText                        (Ptr                     textPtr,
  178.                                  long                     textLength)                            FOURWORDINLINE(0x2F3C, 0x8408, 0x0024, 0xA8B5);
  179.  
  180. EXTERN_API( long )
  181. VisibleLength                    (Ptr                     textPtr,
  182.                                  long                     textLength)                            FOURWORDINLINE(0x2F3C, 0x8408, 0x0028, 0xA8B5);
  183.  
  184. EXTERN_API( void )
  185. GetFormatOrder                    (FormatOrderPtr         ordering,
  186.                                  short                     firstFormat,
  187.                                  short                     lastFormat,
  188.                                  Boolean                 lineRight,
  189.                                  StyleRunDirectionUPP     rlDirProc,
  190.                                  Ptr                     dirParam)                            FOURWORDINLINE(0x2F3C, 0x8012, 0xFFFC, 0xA8B5);
  191.  
  192.  
  193.  
  194. EXTERN_API( void )
  195. TextFont                        (short                     font)                                ONEWORDINLINE(0xA887);
  196.  
  197. EXTERN_API( void )
  198. TextFace                        (StyleParameter         face)                                ONEWORDINLINE(0xA888);
  199.  
  200. EXTERN_API( void )
  201. TextMode                        (short                     mode)                                ONEWORDINLINE(0xA889);
  202.  
  203. EXTERN_API( void )
  204. TextSize                        (short                     size)                                ONEWORDINLINE(0xA88A);
  205.  
  206. EXTERN_API( void )
  207. SpaceExtra                        (Fixed                     extra)                                ONEWORDINLINE(0xA88E);
  208.  
  209. EXTERN_API( void )
  210. DrawChar                        (CharParameter             ch)                                    ONEWORDINLINE(0xA883);
  211.  
  212. EXTERN_API( void )
  213. DrawString                        (ConstStr255Param         s)                                    ONEWORDINLINE(0xA884);
  214.  
  215. EXTERN_API( void )
  216. DrawText                        (const void *            textBuf,
  217.                                  short                     firstByte,
  218.                                  short                     byteCount)                            ONEWORDINLINE(0xA885);
  219.  
  220. EXTERN_API( short )
  221. CharWidth                        (CharParameter             ch)                                    ONEWORDINLINE(0xA88D);
  222.  
  223. EXTERN_API( short )
  224. StringWidth                        (ConstStr255Param         s)                                    ONEWORDINLINE(0xA88C);
  225.  
  226. EXTERN_API( short )
  227. TextWidth                        (const void *            textBuf,
  228.                                  short                     firstByte,
  229.                                  short                     byteCount)                            ONEWORDINLINE(0xA886);
  230.  
  231. EXTERN_API( void )
  232. MeasureText                        (short                     count,
  233.                                  const void *            textAddr,
  234.                                  void *                    charLocs)                            ONEWORDINLINE(0xA837);
  235.  
  236. EXTERN_API( void )
  237. GetFontInfo                        (FontInfo *                info)                                ONEWORDINLINE(0xA88B);
  238.  
  239. EXTERN_API( void )
  240. CharExtra                        (Fixed                     extra)                                ONEWORDINLINE(0xAA23);
  241.  
  242. EXTERN_API( void )
  243. StdText                            (short                     count,
  244.                                  const void *            textAddr,
  245.                                  Point                     numer,
  246.                                  Point                     denom)                                ONEWORDINLINE(0xA882);
  247.  
  248. EXTERN_API( short )
  249. StdTxMeas                        (short                     byteCount,
  250.                                  const void *            textAddr,
  251.                                  Point *                numer,
  252.                                  Point *                denom,
  253.                                  FontInfo *                info)                                ONEWORDINLINE(0xA8ED);
  254.  
  255.  
  256. #if CGLUESUPPORTED
  257. EXTERN_API_C( void )
  258. drawstring                        (const char *            s);
  259.  
  260. EXTERN_API_C( short )
  261. stringwidth                        (const char *            s);
  262.  
  263. EXTERN_API_C( void )
  264. stdtext                            (short                     count,
  265.                                  const void *            textAddr,
  266.                                  const Point *            numer,
  267.                                  const Point *            denom);
  268.  
  269. #endif  /* CGLUESUPPORTED */
  270.  
  271. #if OLDROUTINENAMES
  272. #define NPixel2Char(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom) \
  273.     PixelToChar(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom) 
  274. #define NChar2Pixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom) \
  275.     CharToPixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom)
  276. #define NDrawJust(textPtr, textLength, slop, styleRunPosition, numer, denom) \
  277.     DrawJustified(textPtr, textLength, slop, styleRunPosition, numer, denom)
  278. #define NMeasureJust(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom) \
  279.     MeasureJustified(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom)
  280. #define NPortionText(textPtr, textLen, styleRunPosition, numer, denom)\
  281.     PortionLine(textPtr, textLen, styleRunPosition, numer, denom)
  282. #endif  /* OLDROUTINENAMES */
  283.  
  284.  
  285. #if PRAGMA_STRUCT_ALIGN
  286.     #pragma options align=reset
  287. #elif PRAGMA_STRUCT_PACKPUSH
  288.     #pragma pack(pop)
  289. #elif PRAGMA_STRUCT_PACK
  290.     #pragma pack()
  291. #endif
  292.  
  293. #ifdef PRAGMA_IMPORT_OFF
  294. #pragma import off
  295. #elif PRAGMA_IMPORT
  296. #pragma import reset
  297. #endif
  298.  
  299. #ifdef __cplusplus
  300. }
  301. #endif
  302.  
  303. #endif /* __QUICKDRAWTEXT__ */
  304.  
  305.